package jmine.tec.scheduling.domain;

import static jmine.tec.scheduling.SchedulingMessages.STATUS_EXECUTED;
import static jmine.tec.scheduling.SchedulingMessages.STATUS_FAILED;
import static jmine.tec.scheduling.SchedulingMessages.STATUS_NOT_EXECUTED;

import java.util.Locale;

import bancosys.tec.exception.LocalizedMessageHolder;
import bancosys.tec.exception.MessageCreator;

/**
 * Scheduled task execution status
 * 
 * @author lundberg
 */
public enum ScheduledTaskExecutionStatus implements LocalizedMessageHolder {
    EXECUTED(STATUS_EXECUTED),

    NOT_EXECUTED(STATUS_NOT_EXECUTED),

    FAILED(STATUS_FAILED);

    private final LocalizedMessageHolder delegate;

    /**
     * Constructor
     * 
     * @param creator creator
     */
    private ScheduledTaskExecutionStatus(MessageCreator creator) {
        this.delegate = creator.create();
    }

    /**
     * {@inheritDoc}
     */
    public String getMessage() {
        return this.delegate.getMessage();
    }

    /**
     * {@inheritDoc}
     */
    public String getMessage(Locale locale) {
        return this.delegate.getMessage(locale);
    }
}
